package kingwing.dc.core.model;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.dorado.annotation.PropertyDef;

/**
 * 规则实体（定义爬虫的采集规则）
 * @author Kevin
 * 2017年8月11日
 */
@Entity
@Table(name="DC_RULE")
public class Rule extends BaseEntity {

	private static final long serialVersionUID = -6522853864047446465L;
	
	@PropertyDef(label="规则名")
	@Column(name="RULE_NAME_",length=512)
	private String ruleName;
	
	@PropertyDef(label="域名")
	@Column(name="DOMAINS_",length=512)
	private String domains;
	
	@PropertyDef(label = "入口URL")
	@Column(name="SCAN_URLS_",length=512)
	private String scanUrls;
	
	@PropertyDef(label="内容URL")
	@Column(name="CONTENT_URLS_",length=512)
	private String contentUrls;
	
	@PropertyDef(label="内容URL参数")
	@Column(name="CONTENT_ID_",length=512)
	private String contentId;
	
	@PropertyDef(label="内容页url正则")
	@Column(name="CONTENT_URL_REGEXES_",length=512)
	private String contentUrlRegexes = ".*";
	
	@PropertyDef(label="列表页url正则")
	@Column(name="HELPER_URL_REGEXES_",length=512)
	private String helperUrlRegexes = ".*";
	
	@PropertyDef(label="页面类型",description="0:静态页面规则；1:动态页面规则")
	@Column(name="PAGE_TYPE_",length=512)
	private int pageType = 0;
	
	@PropertyDef(label="采集类型",description="0:列表+详细内容页，1：单页面")
	@Column(name="GRAB_TYPE_",length=512)
	private int grabType = 0;
	
	@PropertyDef(label="是否搜索",description="TRUE:是；FALSE:否")
	@Column(name="CHECK_")
	private boolean check = false;
	
	@PropertyDef(label="任务ID")
	@Column(name="job_Time_Rule_ID_",length=60)
	private String jobTimeRuleID;
	
	@Transient
	private Collection<RuleDetail> ruleDetails;

	public String getDomains() {
		return domains;
	}

	public void setDomains(String domains) {
		this.domains = domains;
	}

	public String getRuleName() {
		return ruleName;
	}

	public void setRuleName(String ruleName) {
		this.ruleName = ruleName;
	}

	public String getScanUrls() {
		return scanUrls;
	}

	public void setScanUrls(String scanUrls) {
		this.scanUrls = scanUrls;
	}

	public String getContentUrlRegexes() {
		return contentUrlRegexes;
	}

	public void setContentUrlRegexes(String contentUrlRegexes) {
		this.contentUrlRegexes = contentUrlRegexes;
	}

	public String getHelperUrlRegexes() {
		return helperUrlRegexes;
	}

	public void setHelperUrlRegexes(String helperUrlRegexes) {
		this.helperUrlRegexes = helperUrlRegexes;
	}

	public String getContentUrls() {
		return contentUrls;
	}

	public void setContentUrls(String contentUrls) {
		this.contentUrls = contentUrls;
	}

	public String getContentId() {
		return contentId;
	}

	public void setContentId(String contentId) {
		this.contentId = contentId;
	}

	public int getPageType() {
		return pageType;
	}

	public void setPageType(int pageType) {
		this.pageType = pageType;
	}

	public int getGrabType() {
		return grabType;
	}

	public void setGrabType(int grabType) {
		this.grabType = grabType;
	}

	public Collection<RuleDetail> getRuleDetails() {
		return ruleDetails;
	}

	public void setRuleDetails(Collection<RuleDetail> ruleDetails) {
		this.ruleDetails = ruleDetails;
	}

	public boolean isCheck() {
		return check;
	}

	public void setCheck(boolean check) {
		this.check = check;
	}

	public String getJobTimeRuleID() {
		return jobTimeRuleID;
	}

	public void setJobTimeRuleID(String jobTimeRuleID) {
		this.jobTimeRuleID = jobTimeRuleID;
	}
	
}
